<template>
  <div>
    <h1>首页</h1>
    <h1>我的路径：{{ route.path }}</h1>
    <button @click="goList">去列表页</button>
  </div>
</template>

<script setup>
    import {useRoute,useRouter} from "vue-router"
    
    //1.获取路由对象
    let router = useRouter(); //路由对象
    let route = useRoute();  //路由路线
    console.log(router,route);

    function goList(){
      //跳转并传参
      router.push("/list?id=12");
    }

</script>

<style>

</style>